package zhang.lao.console.controller.wn.report;/**
 * Created by zhangqin on 2017/8/30.
 */

import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import zhang.lao.build.mybatis.jdbc.auto.model.*;
import zhang.lao.build.redis.RedisUtil;
import zhang.lao.build.tool.date.DateStyle;
import zhang.lao.build.tool.date.DateUtil;
import zhang.lao.service.console.ReportService;
import zhang.lao.dao.base.WnFarmDao;
import zhang.lao.dao.base.WnMachineDeviceActiveGt06Dao;
import zhang.lao.dao.base.WnMachineDeviceDao;
import zhang.lao.pojo.console.ConsoleContext;
import zhang.lao.pojo.console.map.MapSerieResp;
import zhang.lao.pojo.console.report.AreaReportResp;
import zhang.lao.pojo.console.resp.HttpResult;
import zhang.lao.pojo.console.resp.HttpResultUtil;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 报表
 *
 * @author
 * @create 2017-08-30 9:30
 **/
@Controller
public class AutoMachineAreaGt06Report {



    @Autowired
    private ReportService reportService;
    @RequestMapping("/console/report/gt06/area")
    public String getAutoAreaReport(ModelMap modelMap){
        return "console/report/gt06/auto_gt06_area_report";
    }
    @RequestMapping("/console/report/gt06")
    public String getAutogt06Report(ModelMap modelMap){
        return "console/report/gt06/auto_gt06_active";
    }


    @RequestMapping("/console/report/gt06/area/json")
    public @ResponseBody HttpResult getAutoAreaReportJson(ConsoleContext consoleContext,String startDate,String endDate) {
        AreaReportResp areaReportRespGt06 = reportService.getAreaReportRespGt06(startDate, endDate, consoleContext.getFarms());
        return HttpResultUtil.buildSuccess(areaReportRespGt06);
    }

    @RequestMapping("/console/report/gt06/json")
    public @ResponseBody HttpResult activeMachineJson(ConsoleContext consoleContext,String startDate,String endDate){
        AreaReportResp areaReportRespGt06 = reportService.getActiveRespGt06(startDate, endDate, consoleContext.getFarms());
        return HttpResultUtil.buildSuccess(areaReportRespGt06);
    }

}
